<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { mapState, mapActions } from 'pinia'
import { useAuthStore, useSysMsgStore } from '@/store/index'

export default defineComponent({
  name: 'App',

  setup() {
    return {}
  },

  computed: {
    ...mapState(useAuthStore, {
      isLogin: 'isLogin'
    })
  },

  mounted() {
    this.getUserMsgs()
  },

  methods: {
    getUserMsgs() {
      if (!this.isLogin) {
        return
      }
      this.getSysMsgs()
    },

    ...mapActions(useSysMsgStore, {
      getSysMsgs: 'getSysMsgs'
    })
  }
})
</script>

<style lang="scss">
#app {
  height: 100%;
  background-color: #f6f6f6;
}
</style>
